package com.foolishbird.sdk.params.bean;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.List;
import java.util.Stack;


public class ConfigInfo implements Serializable {


    /**
     * 弹窗流程，取值 identify|notice|phone ，实名认证和公告弹窗即时弹窗，不是倒计时
     */
    @SerializedName("popup_flow")
    private String popupFlow ;

    private Stack<String> flowStack;

    /**
     * 手机弹窗为倒计时弹窗，倒计时时间，单位秒(登录成功后倒计时)
     */
    @SerializedName("phone_popup_time")
    private int phonePopupTime;

    /**
     * 实名认证弹窗的文字描述
     */
    @SerializedName("identify_normal_text")
    private String identifyNormalText;

    /**
     * 实名认证弹窗的文字描述，仅用在上一次验证失败后
     */
    @SerializedName("identify_fail_text")
    private String identifyFailText;

    @SerializedName("common_links")
    private CommonLinks commonLinks;

    @SerializedName("floating_window")
    private List<FloatMenu> floatingWindow;


    public String getPopupFlow() {
        return popupFlow;
    }

    public Stack<String> getFlowStack(){
        setFlowStack();
        return flowStack;
    }

    private void setFlowStack(){
        if(flowStack==null){
            String[] flowArray;
            if(popupFlow.contains("|")){
                flowArray = popupFlow.split("\\|");
            }else {
                flowArray =new String[]{popupFlow};
            }
            flowStack = new Stack<>();
            for(int i =flowArray.length-1;i>=0;i--){
                flowStack.push(flowArray[i]);
            }
        }
    }

    public void resetFlowStack(){
        flowStack =null;
        setFlowStack();
    }

    public void setPopupFlow(String popupFlow) {
        this.popupFlow = popupFlow;
//        Log.d("TAG")

    }

    public int getPhonePopupTime() {
        return phonePopupTime;
    }

    public void setPhonePopupTime(int phonePopupTime) {
        this.phonePopupTime = phonePopupTime;
    }

    public String getIdentifyNormalText() {
        return identifyNormalText;
    }

    public void setIdentifyNormalText(String identifyNormalText) {
        this.identifyNormalText = identifyNormalText;
    }

    public String getIdentifyFailText() {
        return identifyFailText;
    }

    public void setIdentifyFailText(String identifyFailText) {
        this.identifyFailText = identifyFailText;
    }

    public CommonLinks getCommonLinks() {
        return commonLinks;
    }

    public void setCommonLinks(CommonLinks commonLinks) {
        this.commonLinks = commonLinks;
    }

    public List<FloatMenu> getFloatingWindow() {
        return floatingWindow;
    }

    public void setFloatingWindow(List<FloatMenu> floatingWindow) {
        this.floatingWindow = floatingWindow;

    }
}
